Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(learn): Collecting code coverage #7006

Merged
merged 6 commits into from
Mar 22, 2025

Conversation

avivkeller
Copy link
Member

Description

This PR introduces a learning article on collecting code coverage in Node.js. However, it should not be merged until support for thresholds is included in the next semver-minor release, which is expected to be next week.

Related Issues

Support for code coverage: nodejs/node#46017
Support for code coverage inclusion/exclusion: nodejs/node#53553
Support for code coverage thresholds: nodejs/node#54429

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npm run format to ensure the code follows the style guide.
  • I have run npm run test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • [N/A] I've covered new added functionality with unit tests if necessary.

Copy link

vercel bot commented Aug 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Mar 22, 2025 1:36pm

@avivkeller
Copy link
Member Author

This is currently marked as draft until the next semver-minor release of Node.js

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my first feedback, I think the introduction should be improved to put it in context. It should be remembered that the learn section is intended for non-experts.

@avivkeller avivkeller force-pushed the code-coverage-learn branch from ee241d0 to f26b449 Compare August 24, 2024 17:12
Copy link

vercel bot commented Aug 24, 2024

Deployment failed with the following error:

The provided GitHub repository does not contain the requested branch or commit reference. Please ensure the repository is not empty.

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

Copy link
Member

@mikeesto mikeesto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this, reads well

@avivkeller avivkeller marked this pull request as ready for review August 25, 2024 23:35
@avivkeller avivkeller requested a review from a team as a code owner August 25, 2024 23:35
@avivkeller
Copy link
Member Author

avivkeller commented Aug 25, 2024

I've undrafted this, as the release proposal for v22.8.0 is ready at nodejs/node#54560, but it still shouldn't land until that does.

The expected release date is 2024-08-26 2024-09-02

Copy link
Contributor

github-actions bot commented Aug 26, 2024

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 90%
88.75% (742/836) 76.1% (242/318) 87.65% (142/162)

Unit Test Report

Tests Skipped Failures Errors Time
182 0 💤 0 ❌ 0 🔥 6.096s ⏱️

Copy link
Collaborator

@bmuenzenmeyer bmuenzenmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great - looking forward to it

@AugustinMauroy
Copy link
Member

Can we have last review form @nodejs/test_runner

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing. However I'm not sure we should be landing this before having stabilized the code coverage functionality.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing. However I'm not sure we should be landing this before having stabilized the code coverage functionality.

@avivkeller
Copy link
Member Author

I think this is okay to land once v22.8.0 releases, as it specifies that the --experimental-code-coverage command is needed, indicating that it is experimental. Would you like me to add a notice at the beginning that this is experimental, or just hold off until it's stabilized?

@mcollina
Copy link
Member

mcollina commented Sep 2, 2024

I think it's better to hold off until it's stable.

@AugustinMauroy AugustinMauroy added content Issues/pr concerning content learn Issues/pr concerning the learn section labels Sep 12, 2024
@avivkeller
Copy link
Member Author

IMO code coverage (w/o the --enable-source-maps flag) is pretty stable. I haven't seen many bugs with it in a while.

I asked a few weeks ago, and it was pointed out that statement coverage isn't supported, however, I'm not sure if that's in the plans for the immediate future of code coverage.

The original issue tracking the stability has been closed as completed, as all tasks were completed, which might mean it's ready to be stable. I've left a comment asking.

@ovflowd
Copy link
Member

ovflowd commented Nov 17, 2024

I'm fine keeping this open for the meantime, the problem is it becoming stale.

@avivkeller
Copy link
Member Author

I'm also happy to close and reopen it, as chances are there will be some significant changes to the coverage reporter before stabilization, and this only collecting merge conflicts.

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avivkeller has there been any change yet? I feel we could merge the PR to be honest.

@avivkeller
Copy link
Member Author

avivkeller commented Mar 22, 2025

It's still experimental, but it's more stable, so I also think this can be merged.

@mcollina are you still blocking?

(I'll resolve the conflicts later today)

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

avivkeller and others added 4 commits March 22, 2025 09:26
Signed-off-by: Aviv Keller <[email protected]>
Co-authored-by: Michael Esteban <[email protected]>
Signed-off-by: Aviv Keller <[email protected]>
Signed-off-by: Aviv Keller <[email protected]>
Copy link
Contributor

github-actions bot commented Mar 22, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 93 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 100 🟢 100 🟢 100 🟢 92 🔗
/en/download 🟢 92 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 99 🟢 100 🟢 96 🟢 92 🔗

@avivkeller avivkeller added the github_actions:pull-request Trigger Pull Request Checks label Mar 22, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Mar 22, 2025
@avivkeller avivkeller added this pull request to the merge queue Mar 22, 2025
Merged via the queue into nodejs:main with commit a42315e Mar 22, 2025
15 checks passed
@avivkeller avivkeller deleted the code-coverage-learn branch March 22, 2025 13:44
@avivkeller
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Issues/pr concerning content learn Issues/pr concerning the learn section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants